<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>保教费报表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="报表">
	<meta http-equiv="description" content="tuitionReport.jsp">

  </head>
  
  <body> 
    <center>
    	<s:form name="frm" id="frm" method="post" action="getReport.action" namespace="/inner/common">
    		<jsp:include page="/jsp/outward/business/common/menuLink.jsp">
    			<jsp:param name="menuLink" value="[{'name':'报表管理'},{'name':'保教费报表'}]"/>
    			<jsp:param name="width" value="40%"/>
    		</jsp:include>
    		<s:hidden id="kindergartenId" name="kindergartenId"></s:hidden>
    		<s:hidden id="showType" name="showType"></s:hidden>
    		<table cellspacing="1" cellpadding="3" width="100%" bgcolor="#CCCCCC">
				<tr bgcolor="#FFFFFF">
					<td align="right" width="10%" class="label">
						所属班级：
					</td>
					<td align="left" width="23%">
						<s:select name="trvo.classId" id="classId" value="%{trvo.classId}" list="classList" listKey="id" listValue="className" headerKey="" headerValue="--请选择--" cssStyle="width:120px" cssClass="search"></s:select>
					</td>
					<td align="right" width="10%" class="label">
						学童姓名：
					</td>
					<td align="left" width="23%">
						<s:textfield name="trvo.childName" id="trvo.childName" cssStyle="width:120px" cssClass="search"></s:textfield>
					</td>
					<td align="right" width="10%" class="label">
						年份：
					</td>
					<td align="left" width="24%">
						<s:select list="years" listKey="period" listValue="period" name="trvo.periodStart" id="periodStart" cssStyle="width:100px" cssClass="search"></s:select>
						至
						<s:select list="years" listKey="period" listValue="period" name="trvo.periodEnd" id="periodEnd" cssStyle="width:100px" cssClass="search"></s:select>
					</td>
				</tr>
				<tr bgcolor="#FFFFFF">
					<td align="right" width="10%" class="label">
						学童编号：
					</td>
					<td align="left" width="23%" colspan="5">
						<s:textfield name="trvo.childNo" id="trvo.childNo" cssStyle="width:115px" cssClass="search"></s:textfield>
					</td>
				</tr>
			</table>
    		
    		<table cellspacing="0" width="100%">
				<tr>
					<td align="left">
						<input type="button" value="查询" class="btn" onclick="searchThis()"/>
						<input type="button" value="重置" class="btn" onclick="toResetSearch()"/>
						<input type="button" value="ToExcel" class="btn" onclick="toExcel()"/>
					</td>
				</tr>
			</table>
			
			<div id="reportDiv" style="width:100%; display:inline-block; float:left; overflow-x:scroll; overflow-y:scroll; overflow:visible;">
    		<table width="<s:property value='tableWidth' />px" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">
    			<tr align="center" class="tableHead">
    				<td>
    					班次
    				</td>
    				<td>
    					学童编号
    				</td>
    				<td>
    					学童姓名
    				</td>
    				<td>
    					班级名称
    				</td>
    				<td>
    					合计
    				</td>
    				<td>
    					年度
    				</td>
    				<td>
    					一月
    				</td>
    				<td>
    					二月
    				</td>
    				<td>
    					三月
    				</td>
    				<td>
    					四月
    				</td>
    				<td>
    					五月
    				</td>
    				<td>
    					六月
    				</td>
    				<td>
    					七月
    				</td>
    				<td>
    					八月
    				</td>
    				<td>
    					九月
    				</td>
    				<td>
    					十月
    				</td>
    				<td>
    					十一月
    				</td>
    				<td>
    					十二月
    				</td>
    				<s:iterator value="title" status="s">
    					<td>
    						<s:property value="indexName" />
    					</td>
    				</s:iterator>
    			</tr>
    			<s:iterator value="lp.list" status="s" var ="v">
    				<tr align="center"
    					<s:if test="#s.index%2==0">class="tableRow2" onMouseMove="this.className='tableRow3'" onMouseOut="this.className='tableRow2'"</s:if>
						<s:else>class="tableRow1" onMouseMove="this.className='tableRow3'" onMouseOut="this.className='tableRow1'"</s:else>
    				>
    					<td>
    						<s:property value="classtype" />
    					</td>
    					<td>
    						<s:property value="childnum"/>
    					</td>
    					<td>
    						<s:property value="childname"/>
    					</td>
    					<td>
	    					<s:property value="classname"/>
    					</td>
    					<td>
    						<s:if test='sumAmount != 0'>
	    					<s:property value="sumAmount"/>
    						</s:if>
    					</td>
    					<td>
	    					<s:property value="year"/>
    					</td>
    					<td>
    						<s:if test='column1 != 0'>
	    					<s:property value="column1"/>
    						</s:if>
    					</td>
    					<td>
    						<s:if test='column2 != 0'>
	    					<s:property value="column2"/>
	    					</s:if>
    					</td>
    					<td>
    						<s:if test='column3 != 0'>
	    					<s:property value="column3"/>
	    					</s:if>
    					</td>
    					<td>
    						<s:if test='column4 != 0'>
	    					<s:property value="column4"/>
	    					</s:if>
    					</td>
    					<td>
    						<s:if test='column5 != 0'>
	    					<s:property value="column5"/>
	    					</s:if>
    					</td>
    					<td>
    						<s:if test='column6 != 0'>
	    					<s:property value="column6"/>
	    					</s:if>
    					</td>
    					<td>
    						<s:if test='column7 != 0'>
	    					<s:property value="column7"/>
	    					</s:if>
    					</td>
    					<td>
    						<s:if test='column8 != 0'>
	    					<s:property value="column8"/>
	    					</s:if>
    					</td>
    					<td>
    						<s:if test='column9 != 0'>
	    					<s:property value="column9"/>
	    					</s:if>
    					</td>
    					<td>
    						<s:if test='column10 != 0'>
	    					<s:property value="column10"/>
	    					</s:if>
    					</td>
    					<td>
    						<s:if test='column11 != 0'>
	    					<s:property value="column11"/>
	    					</s:if>
    					</td>
    					<td>
    						<s:if test='column12 != 0'>
	    					<s:property value="column12"/>
	    					</s:if>
    					</td>
    					<s:iterator value="title" status="s" var ="t">
    					<td>
    						<s:if test='#v.get(#t.indexName) != 0'>
    						<s:property value="%{#v.get(#t.indexName)}" />
    						</s:if>
    					</td>
    					</s:iterator>
    				</tr>
    			</s:iterator>
    			<s:iterator value="total" status="s" var ="vv">
    				<tr align="center" bgcolor="yellow">
    					<td colspan="4" align="left" >
    						<font style="font-weight:bold;">总计：</font>
    					</td>
    					<td>
	    					<s:property value="sumAmount"/>
    					</td>
    					<td>
	    					&nbsp;
    					</td>
    					<td>
	    					<s:property value="column1"/>
    					</td>
    					<td>
	    					<s:property value="column2"/>
    					</td>
    					<td>
	    					<s:property value="column3"/>
    					</td>
    					<td>
	    					<s:property value="column4"/>
    					</td>
    					<td>
	    					<s:property value="column5"/>
    					</td>
    					<td>
	    					<s:property value="column6"/>
    					</td>
    					<td>
	    					<s:property value="column7"/>
    					</td>
    					<td>
	    					<s:property value="column8"/>
    					</td>
    					<td>
	    					<s:property value="column9"/>
    					</td>
    					<td>
	    					<s:property value="column10"/>
    					</td>
    					<td>
	    					<s:property value="column11"/>
    					</td>
    					<td>
	    					<s:property value="column12"/>
    					</td>
    					<s:iterator value="title" status="s" var ="tt">
    					<td>
    						<s:property value="%{#vv.get(#tt.indexName)}" />
    					</td>
    					</s:iterator>
    				</tr>
    			</s:iterator>
    			
    			<jsp:include page="/common/pager/pager.jsp">
					<jsp:param name="formName" value="frm" />
					<jsp:param name="id" value="1" />
				</jsp:include>
    		</table>
    		</div>
    	</s:form>
    </center>
    <script type="text/javascript">
    $(function(){
    	autoSize();
    });

    function autoSize()
    {
    	var reportDiv = $('#reportDiv');
        var divTop = reportDiv.offset().top;
        var winHeight = $(window).height();
        var winWidth = $(window).width();
        var divHeight = parseInt(winHeight) - parseInt(divTop);
        reportDiv.height(divHeight);
        reportDiv.width(winWidth);
        setTimeout('autoSize()', 200);
    }
    
    function searchThis()
    {
    	if(checkQuery() == false)
    	{
    		return;
    	}
    	document.forms['frm'].target = '_self';
    	$('#thisPage').val(1);
    	$('#frm').submit();
    }

    function toExcel()
    {
    	if(checkQuery() == false)
    	{
    		return;
    	}
		var url = realPath + '/inner/common/getReportExcel.action';
		document.forms['frm'].target = '_blank';
		document.forms['frm'].action = url;
		document.forms['frm'].submit();
		document.forms['frm'].action = realPath + '/inner/common/getReport.action';
		document.forms['frm'].target = '_self';
    }
    
    function toResetSearch()
    {
    	resetSearch();
    	var periodStart = $('#periodStart');
    	var periodEnd = $('#periodEnd');
    	var date = new Date();
    	var year = date.getYear();
    	periodStart.val(year);
    	periodEnd.val(year);
    }
    
    function checkQuery()
    {
    	var periodStart = $('#periodStart');
    	var periodEnd = $('#periodEnd');
    	var payDateStart = $('#payDateStart');
    	var payDateEnd = $('#payDateEnd');
    	if(parseInt(periodStart.val()) > parseInt(periodEnd.val()))
    	{
    		showMsg('开始年份不能大于结束年份。');
    		return false;
    	}
    	if(isNotNull(payDateStart.val()) && isNotNull(payDateEnd.val()) && payDateStart.val() > payDateEnd.val())
    	{
    		showMsg('开始交费日期不能大于结束交费日期。');
    		return false;
    	}
    	return true;
    }

    function showTuition(id)
    {
    	var kgId = getTopKg();
    	var url = realPath + '/inner/charge/toUpdateTuition.action?tuition.id=' + id + '&kindergartenId=' + kgId;
    	window.location.href = url;
    }
    </script>
  </body>
</html>
